package buaa.leetcode.Array;

public class RemoveDuplicateFromSortedArray {
	 public static int removeDuplicates(int[] A) {
	        if(A.length == 0){
	        	return 0;
	        }
	        int curr = 1;
	        int index = 1;
	        int prev = A[0];
	        while(index < A.length){
	        	if(A[index] != prev){
	        		A[curr++] = A[index];
	        		prev = A[index];
	        	}
	        	index++;
	        }
	        return curr;
	  }
	 public static void main(String[] args){
		 System.out.println(removeDuplicates(new int[]{1,1,2}));
	 }
}
